package com.wn.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author yellow Docter
 * @date 2022 -07-06
 * @desc
 */
@Component
public class User {

    @Value("王语嫣")
    private String name;

    @Value("30")
    private Integer age;

    /**
     * 从 ioc容器中找 Car 的类型 自动注入进来
     */
//    @Autowired
//    private  Car car;

    @Qualifier("c2")
    @Autowired
    private Car car;

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", car=" + car +
                '}';
    }
}
